/**
 * Created by wang on 2016-3-2.
 */
define(function () {
    'use strict';

    function ctrl($scope,$stateParams,WebService, CommonService) {

        var par = $scope.param = {};
        par.id = $stateParams['id'];
        par.title = $stateParams['title'];

        init();

        $scope.doRefresh = function() {
            init().finally(function(){
                $scope.$broadcast('scroll.refreshComplete');
            });
        };


        function init(){

            return WebService.wzContents(par.id, 0).then(function(data){
                $scope.items = data;
                if(data && data.length > 0) {
                    par.title = data[0].channelName;
                }
            });
        }

    }

    ctrl.$inject = ['$scope','$stateParams','WebService', 'CommonService'];
    return ctrl;
});